Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Turns anonymous functions into class methods #89

Closed
wants to merge 2 commits into from

Conversation

flore2003
Copy link
Contributor

Currently most methods on the MistralClient are implemented as anonymous functions/class fields (myMethod = function() {...}). This makes it hard to inherit, overwrite, and monkeypatch these methods.

Example:

import * as MistralAI from "@mistralai/mistralai";

const originalChat = MistralAI.prototype.chat;
MistralAI.prototype.chat = function(...) {...};
// originalChat is undefined

This PR changes all of these functions to real class methods, which allows for easier monkeypatching etc.

Closes #58

@GaspardBT
Copy link
Contributor

Thanks for opening this PR. We have deprecated this package in favor of mistralai/client-ts, which is the new official Mistral client, compatible with both TypeScript and JavaScript.

You can find all installation information here.

This change is effective starting with version 1.0.0 of the npm package.

@GaspardBT GaspardBT closed this Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor arrow function class methods for better inheritance support
2 participants